#!/bin/bash/python
# _*_ coding: utf-8 _*_
# file： get_local_ip
# date-time: 2023/10/19-15:52
# auth:hard work
# description
import socket


def get_host_ip():
    """
    查询本机ip地址
    :return: ip
    """
    global s
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(('8.8.8.8', 80))
        ip = s.getsockname()[0]
    finally:
        s.close()

    return ip

if __name__ == '__main__':
    print(get_host_ip())
